PROJECT(infer_demo C CXX)
CMAKE_MINIMUM_REQUIRED(VERSION 3.10)
# specify the decompress directory of FastDeploy SDK
option(FASTDEPLOY_INSTALL_DIR "Path of downloaded fastdeploy sdk.")
include(${FASTDEPLOY_INSTALL_DIR}/utils/gflags.cmake)
include(${FASTDEPLOY_INSTALL_DIR}/FastDeploy.cmake)

include_directories(${FASTDEPLOY_INCS})
# include common use benchmark/cpp headers.
include_directories(${PROJECT_SOURCE_DIR}/../cpp)

# add common use benchmark bin from fastdeploy
add_executable(benchmark ${PROJECT_SOURCE_DIR}/../cpp/benchmark.cc)
# add specific use benchmark bins for paddlex
add_executable(benchmark_ppcls ${PROJECT_SOURCE_DIR}/benchmark_ppcls.cc)
add_executable(benchmark_ppseg ${PROJECT_SOURCE_DIR}/benchmark_ppseg.cc)
add_executable(benchmark_ppdet ${PROJECT_SOURCE_DIR}/benchmark_ppdet.cc)
add_executable(benchmark_ppocr_det ${PROJECT_SOURCE_DIR}/benchmark_ppocr_det.cc)
add_executable(benchmark_ppocr_rec ${PROJECT_SOURCE_DIR}/benchmark_ppocr_rec.cc)
add_executable(benchmark_structurev2_table ${PROJECT_SOURCE_DIR}/benchmark_structurev2_table.cc)
add_executable(benchmark_structurev2_layout ${PROJECT_SOURCE_DIR}/benchmark_structurev2_layout.cc)
add_executable(benchmark_ppshituv2_rec ${PROJECT_SOURCE_DIR}/benchmark_ppshituv2_rec.cc)
add_executable(benchmark_ppshituv2_det ${PROJECT_SOURCE_DIR}/benchmark_ppshituv2_det.cc)
add_executable(benchmark_pp3d_caddn ${PROJECT_SOURCE_DIR}/benchmark_pp3d_caddn.cc)
add_executable(benchmark_pp3d_centerpoint ${PROJECT_SOURCE_DIR}/benchmark_pp3d_centerpoint.cc)

if(UNIX AND (NOT APPLE) AND (NOT ANDROID))
  target_link_libraries(benchmark ${FASTDEPLOY_LIBS} gflags pthread)
  target_link_libraries(benchmark_ppcls ${FASTDEPLOY_LIBS} gflags pthread)
  target_link_libraries(benchmark_ppseg ${FASTDEPLOY_LIBS} gflags pthread)
  target_link_libraries(benchmark_ppdet ${FASTDEPLOY_LIBS} gflags pthread)
  target_link_libraries(benchmark_ppocr_det ${FASTDEPLOY_LIBS} gflags pthread)
  target_link_libraries(benchmark_ppocr_rec ${FASTDEPLOY_LIBS} gflags pthread)
  target_link_libraries(benchmark_structurev2_table ${FASTDEPLOY_LIBS} gflags pthread)
  target_link_libraries(benchmark_structurev2_layout ${FASTDEPLOY_LIBS} gflags pthread)
  target_link_libraries(benchmark_ppshituv2_rec ${FASTDEPLOY_LIBS} gflags pthread)
  target_link_libraries(benchmark_ppshituv2_det ${FASTDEPLOY_LIBS} gflags pthread)
  target_link_libraries(benchmark_pp3d_caddn ${FASTDEPLOY_LIBS} gflags pthread)
  target_link_libraries(benchmark_pp3d_centerpoint ${FASTDEPLOY_LIBS} gflags pthread)
else()
  target_link_libraries(benchmark ${FASTDEPLOY_LIBS} gflags)
  target_link_libraries(benchmark_ppcls ${FASTDEPLOY_LIBS} gflags)
  target_link_libraries(benchmark_ppseg ${FASTDEPLOY_LIBS} gflags)
  target_link_libraries(benchmark_ppdet ${FASTDEPLOY_LIBS} gflags)
  target_link_libraries(benchmark_ppocr_det ${FASTDEPLOY_LIBS} gflags)
  target_link_libraries(benchmark_ppocr_rec ${FASTDEPLOY_LIBS} gflags)
  target_link_libraries(benchmark_structurev2_table ${FASTDEPLOY_LIBS} gflags)
  target_link_libraries(benchmark_structurev2_layout ${FASTDEPLOY_LIBS} gflags)
  target_link_libraries(benchmark_ppshituv2_rec ${FASTDEPLOY_LIBS} gflags)
  target_link_libraries(benchmark_ppshituv2_det ${FASTDEPLOY_LIBS} gflags)
  target_link_libraries(benchmark_pp3d_caddn ${FASTDEPLOY_LIBS} gflags)
  target_link_libraries(benchmark_pp3d_centerpoint ${FASTDEPLOY_LIBS} gflags)
endif()
# only for Android ADB test
if(ANDROID)
  install_fastdeploy_libraries(${CMAKE_CURRENT_BINARY_DIR})
endif()
